<template>
    <div class="home-page">
        <el-container class="podium-container">
            <el-header height="60px">
                <HeaderView :title="title"></HeaderView>
            </el-header>
            <el-container>
                <el-aside width="280px">
                    <AsideView></AsideView>
                </el-aside>
                <el-main>
                    <el-breadcrumb separator-class="el-icon-arrow-right">
                        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                        <el-breadcrumb-item v-if="$route.name != 'Home' && $route.meta.parentMenuName">
                            {{ $route.meta.parentMenuName }}
                        </el-breadcrumb-item>
                        <el-breadcrumb-item v-if="$route.name != 'Home'">{{ $route.meta.title }}</el-breadcrumb-item>
                    </el-breadcrumb>
                    <div class="main-content">
                        <router-view />
                    </div>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script lang="ts" setup>
import HeaderView from '@/components/home/HeaderView.vue';
import AsideView from '@/components/home/AsideView.vue';
import router from '@/router/index'
import userStore from '@/store/user'
import { ref, onMounted } from 'vue'
const title = ref('群楼后台基础管理系统')

onMounted(() => {
    const token = userStore.state.token
    if (!token) {
        router.push('/login')
    }else{
        userStore.commit('SET_MENU_LIST')
    }
    
})
</script>

<style lang="scss" scoped>
.home-page {
    width: 100%;
    height: 100%;

    .el-container {
        height: 100%;

        .el-header {
            background-color: var(--header-bg-color);
            border-bottom: 1px solid var(--menu-aside-border-color);
        }

        .el-aside{
            background-color: var(--menu-aside-bg-color);
            border-right: 1px solid var(--menu-aside-border-color);
        }

        .el-main {
            padding: 0 8px;

            .el-breadcrumb {
                width: 100%;
                height: 30px;
                line-height: 30px;
            }

            .main-content {
                width: 100%;
                height: calc(100% - 30px);
                background-color: #f3f3f3;
                padding: 10px;
                box-sizing: border-box;
            }
        }
    }
}
</style>